<extend name="./public/frame.html"/>
<block name="content">
	<style>
		.layui-form-label{width: 10%;}
		.layui-input-block{margin-left: 12%;}
	</style>
	<h2 style="text-align: center;">平台备案</h2>
	<form class="layui-form layui-form-pane1" method="post" >
		<div class="layui-form-item">
			<label class="layui-form-label"><i style="color:red;font-size: 28px;vertical-align: bottom;">*</i>汽车经营许可证号</label>
			<div class="layui-input-inline">
			  <input type="text" name="licence" value="{$data.licence}" class="layui-input">
			</div>
			<div class="layui-form-mid layui-word-aux">平台经营许可证编号</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><i style="color:red;font-size: 28px;vertical-align: bottom;">*</i>经营区域</label>
			<div class="layui-input-inline">
			  <input type="text" name="serviceZone" value="{$data.serviceZone}" class="layui-input">
			</div>
			<div class="layui-form-mid layui-word-aux">公司经营的地理区域</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><i style="color:red;font-size: 28px;vertical-align: bottom;">*</i>注册地行政区代码</label>
			<div class="layui-input-inline">
			  <input type="text" name="adminCode" value="{$data.adminCode}" class="layui-input">
			</div>
			<div class="layui-form-mid layui-word-aux">注册地行政区代码</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><i style="color:red;font-size: 28px;vertical-align: bottom;">*</i>法人身份证照片</label>
			<div class="layui-input-block">
				<div class="layui-upload">
					<button type="button" class="layui-btn" id="test3">上传图片</button>
					<div class="layui-upload-list">
					<!-- 	<img class="layui-upload-img" id="demo3" src="{$data.legalIdCardPhoto}"> -->
						<img class="layui-upload-img" id="demo3" src="{$data.legalIdCardPhoto}">
						
					</div>
				</div>
				<input type="hidden" name="legalIdCardPhoto" id="legalIdCardPhoto" value="{$data.legalIdCardPhoto}">
				
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><i style="color:red;font-size: 28px;vertical-align: bottom;">*</i>法人电话</label>
			<div class="layui-input-inline">
			  <input type="text" name="legalTel" value="{$data.legalTel}" class="layui-input">
			</div>
			<div class="layui-form-mid layui-word-aux">法人电话</div>
		</div>
		
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" layer-submit id="submits">立即提交</button>
	
			</div>
		</div>
	</form>

	<script>
		layui.use(['laydate', 'upload','form'], function () {
			var laydate = layui.laydate
				,upload = layui.upload
				,form = layui.form
			;
			upload.render({
				elem: '#test3'//这个就等同于点击
				,url: '/admin/Upload/base64EncodeImage'
				,before: function(obj){
				
				}
				,done:  function(res){ //上传后的回调
					console.log(res)		
					if(res.status == 1){
						$("#demo3").attr('src',res.base_img);
						$("#legalIdCardPhoto").val(res.base_img);
					
					  
					}else{
						layer.msg(res.msg,{'icon':2});
					}
				},
				error: function(e){
					console.log(e)
				  //layer.msg('上传失败');
				 
				}
			}); 
		
		
		});
	// 	$("#submits").click(function(){
	// 		 var formData = $('form').serializeArray();
	
	// //		alert(JSON.stringify(transformToJson(formData)));
	// 		var json = JSON.stringify(transformToJson(formData));
	// 		// $.post('http://47.98.249.173:8081/transfer',{'tag':1,'json':json},function(data){
	// 		// 	console.log(data)

	// 		// },'json')

	// 			$.ajax({
	// 				type:"post",    //请求方式
	// 				async:true,    //是否异步
	// 				url:"http://47.98.249.173:8081/transfer",
	// 				dataType:"jsonp",    //跨域json请求一定是jsonp
	// 				jsonp: "callbackparam",    //跨域请求的参数名，默认是callback
	// 				  //jsonpCallback:"successCallback",    //自定义跨域参数值，回调函数名也是一样，默认为jQuery自动生成的字符串
	// 				data:{'tag':1,'json':json},    //请求参数

	// 				beforeSend: function() {
	// 					console.log(json);
	// 				 //请求前的处理
	// 				},

	// 				success: function(data) {
	// 					console.log(data)
	// 				 //请求成功处理，和本地回调完全一样
	// 				},

	// 				complete: function(res) {
	// 					console.log(res)
	// 				 //请求完成的处理
	// 				},

	// 				error: function() {
	// 				 //请求出错处理
	// 				}
	// 				});
	// 		})
	//     function transformToJson(formData){
	//         var obj={}
	//         for (var i in formData) {
	//             /*[{"name":"user","value":"hpc"},{"name":"pwd","value":"123"},{"name":"sex","value":"M"},{"name":"age","value":"100"},{"name":"phone","value":"13011112222"},{"name":"email","value":"xxx@xxx.com"}]
	//             */
	//             //下标为的i的name做为json对象的key，下标为的i的value做为json对象的value
	//             obj[formData[i].name]=formData[i]['value'];
	//         }
	//         return obj;
	//     }
	</script>
</block>
